# coding: utf-8

from django.db import models
from main.common.perm.perms_config import ALL_PERMS
from django.contrib.auth.models import Group, User, Permission


if not hasattr(Group, "limit"):

    remark = models.TextField(
        "用户备注",
        blank=True,
        help_text="用户备注",
    )
    remark.contribute_to_class(User, "remark")
    avatar = models.TextField(
        "用户avatar",
        blank=True,
        help_text="用户avatar",
    )
    avatar.contribute_to_class(User, "avatar")
    operator_name = models.CharField(
        "操作人名称",
        max_length=20,
        blank=True,
        default="",
    )
    delete_time = models.DateTimeField(
        "删除时间",
        help_text="删除时间",
        null=True,
        blank=True,
        db_index=True,
    )
    update_time = models.DateTimeField(
        "更新时间",
        help_text="更新时间",
        auto_now=True,
    )
    operator_name.contribute_to_class(User, "operator_name")
    delete_time.contribute_to_class(User, "delete_time")
    update_time.contribute_to_class(User, "update_time")

    operator_name.contribute_to_class(Group, "operator_name")
    delete_time.contribute_to_class(Group, "delete_time")
    update_time.contribute_to_class(Group, "update_time")
